home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
compuserve-file-archive
/
05 Programming
/
WINDOC.BIN
< prev
next >
Wrap
Text File
|
2019-04-13
|
8KB
|
178 lines
WINDOW WONDER
FOR C-128, 80-COLUMN TEXT SCREEN WITH RGBI MONITOR
Even the most carefully written program can take several seconds
to create an elaborate text screen or menu. If the program depends
upon speed to produce a desired impact or reduce waiting time for the
user, Window Wonder may be helpful.
Window Wonder, a machine language utility written for the
Commodore C-128, allows the contents of the entire 80-column text
screen or of a sub-window to be alternately stored into memory and then
restored to the screen. BASIC 7.0's WINDOW command, however useful,
lacks the provision to restore the screen once the WINDOW is removed.
Window Wonder allows the emulation of pull-down menus heretofore found
only in the most powerful home computers.
The C-128 eighty-column screen memory is a separate 16K of RAM
contained in the 8563 chip. The screen can be accessed only through
two registers shared by the 8563 chip and the C-128 I/O memory: the
address register (54784) and the data register (54785) through which
all information must serially pass to be printed to the screen. Since
the 8563 chip is serviced by its own interrupt cycle, timing is
ultimately important to insure that the data register contains valid
information. If the task of reading data from the 8563 chip is
attempted in BASIC, the result is painfully slow. Machine language,
however, provides a lightning fast transfer of data.
DOWNLOADING THE WINDOW WONDER FILES
The Window Wonder machine language routine, called WINDOW.BIN/binary
in this DL, should be saved to disk as "window.obj". Once window.obj
is loaded into memory and initialized you may BSAVE the file on as many
disks as you like by entering the following statement followed by
RETURN: BSAVE"WINDOW.OBJ", B0, P8192 TO P8864.
An optional demonstration program written in BASIC, "WINDEM.BIN/binary,
shows how Window Wonder is easily used in BASIC programming. The assembler
source code is also included for your information. The source code is a
sequential file called "WINSRC.SEQ", and should be read or printed in
all capital letters (printer secondary address = 0).
SIMPLE SYNTAX
It is not necessary that the Window Wonder user have any
any knowledge of ML programming as long as a few simple rules are
observed. Since the 80-col. screen can fill most of the 8563 RAM, it
was difficult to find a suitably large unused area in bank 0 of C-128
memory in which to store screen data. I finally decided to use the 8K
block of RAM occupied by the VIC bitmap beginning at location 8192. My
rationale was that most programs utilizing the 80-col. screen handle
text and don't require the bitmap. Normally BASIC program text begins
at 8192. When the bitmap is allocated by using the command "GRAPHIC 1"
the BASIC program is moved to RAM underlying BASIC LO ROM.
Although the Window Wonder ML routine allocates and clears the
VIC bitmap during initialization, it is necessary to issue the BASIC
command "GRAPHIC 1,1:GRAPHIC 0" (or "GRAPHIC 1,1:GRAPHIC 5" if you are
already using the 80-col.screen) when BLOADing the binary file from a
BASIC program. If this is not done the ML code will be loaded right
over the BASIC program.
WINDOW WONDER page 2
Window Wonder is initialized by the command SYS 8192.
Initialization allocates and clears the bitmap, moves BASIC program
text, prints a message to the screen, and sets the routine to "store"
mode. The command SYS 8500 alternately "stores" and then "restores"
the 80-col. screen. Window Wonder has a "back door" which initializes
the routine without printing the opening message. Then it resets to
the store mode, dumping any old screen previously stored. I call SYS
8463 the "back door" because originally I wasn't going to document
it. See the flow chart below for a more graphic explanation.
PROGRAMMING PROCEDURES FLOW CHART
U```````````````````````````````I U```````````````````````````````I
} starting in direct mode } } starting in basic prg. }
J```````````````2```````````````K J```````````````2```````````````K
} }
U```````````````1```````````````I U```````````````1```````````````I
} bload 'window.obj', b0, p8192 } }move basic, clr map:graphic 1,1}
} initialize: sys 8192 } J```````2````````````````2``````K
J```````2```````````````2```````K } }
} } U```````1``````I U```````1``````I
U```````1``````I U``````1```````I } 40 col. scrn.} } 80 col. scrn.}
} 40 col. scrn.} } 80 col. scrn.} } graphic 0 } } graphic 5 }
}change to rgbi} J``````2```````K J```````2``````K J```````2``````K
J```````2``````K } } }
} } U```````1````````````````1``````I
U```````1```````````````1```````I } bload 'window.obj', b0, p8192 }
} develop or load basic program } } initialize: sys 8192 }
} run } J```````2````````````````2``````K
J```````````````2```````````````K } }
} U```````1``````I U```````1``````I
} } 40 col. scrn.} } 80 col. scrn.}
} }change to rgbi} J```````2``````K
} J```````2``````K }
U```````````````1`````````````````````````1````````````````1``````I
} to store: set window & sys 8500 then clear window & print menu }
} to restore: sys8500 then change window back again _.
J````````````````````````````````2````````````````````````````````K^
} ^
U````````````````````````````````1````````````````````````````````I^
} if nmi (run/stop, restore) occurs then use reset: sys 8463 +=
J`````````````````````````````````````````````````````````````````K
IMPORTANT INFORMATION
Remember that Kernal and BASIC ROM, RAM(0) and I/O memory must be
brought into context (BANK 15) when window.obj is called to prevent
the occurrence of a system crash. It is important that the WINDOW size
not be changed prior to restoring the screen. Also be certain to store
a window before clearing it or you will subsequently restore a cleared
window.
WINDOW WONDER TEST
You may test Window Wonder in the direct mode by entering the
command SYS 8500 to store the screen, press SHIFT & CLR/HOME to
clear the screen, and SYS 8500 again to restore the screen. The cursor
WINDOW WONDER page 3
returns to the screen at the same position it was when the ML routine
was called. This test shows how window.obj may be used to quickly
store and subsequently restore a complex screen without using the
WINDOW command.
PRACTICAL DEMONSTRATION
WINDEM.BIN/binary, is a BASIC program that simulates an
eighty-col. terminal. This program uses pull-down menus which may be
called by pressing CONTROL and 1, 2 or 3. Press "7" to exit a menu and
to return to "terminal" mode. The demo is not a functioning terminal
but a practical example of how Window Wonder may be used in your own
programming. By LISTing the program to the screen, the lines showing
specific examples will be highlighted.
CONTINGENCY
All Window Wonder files copyright 1987 by Ron LeMon but are
placed in the public domain contingent that they be creatively used
and generously shared but never for profit!
SUMMARY
ALLOCATE & CLEAR BITMAP: GRAPHIC 1,1
SELECT 80-COL. SCREEN: GRAPHIC 5
BLOAD"WINDOW.OBJ", B0, P8192
BSAVE"WINDOW.OBJ", B0, P8192 TO P8864
(Default drive & device numbers are used)
INITIALIZE: SYS 8192
RESET (Back Door): SYS 8463
STORE or RESTORE: SYS 8500
Ron LeMon
76556,2477